/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.meteocal.boundary;

import java.util.Calendar;
import java.util.GregorianCalendar;

/**
 *
 * @author Emergenza
 */
public class WeatherConverter {

    public static String getText(int i) {
        String s = "";
        if(i >= 900 && i <= 906){
            s = "EXTREME WEATHER CONDITION FORECAST: ";
        }
        switch(i){
            case 200: 	s= s + "The forecast is thunderstorm with light rain";break;
            case 201: 	s= s + "The forecast is thunderstorm with rain";break;
            case 202: 	s= s + "The forecast is thunderstorm with heavy rain";break;
            case 210: 	s= s + "The forecast is light thunderstorm";break;
            case 211: 	s= s + "The forecast is thunderstorm";break;
            case 212: 	s= s + "The forecast is heavy thunderstorm";break;
            case 221: 	s= s + "The forecast is ragged thunderstorm";break;
            case 230: 	s= s + "The forecast is thunderstorm with light drizzle";break;
            case 231: 	s= s + "The forecast is thunderstorm with drizzle";break;
            case 232: 	s= s + "The forecast is thunderstorm with heavy drizzle"; break;
                
            case 300:	s= s + "The forecast is light intensity drizzle";break;
            case 301: 	s= s + "The forecast is drizzle";break;
            case 302: 	s= s + "The forecast is heavy intensity drizzle";break;
            case 310: 	s= s + "The forecast is light intensity drizzle rain";break;
            case 311: 	s= s + "The forecast is drizzle rain";break;
            case 312: 	s= s + "The forecast is heavy intensity drizzle rain";break;
            case 313: 	s= s + "The forecast is shower rain and drizzle";break;
            case 314: 	s= s + "The forecast is heavy shower rain and drizzle";break;
            case 321: 	s= s + "The forecast is shower drizzle";break;
                
            case 500: 	s= s + "The forecast is light rain";break;
            case 501: 	s= s + "The forecast is moderate rain";break;
            case 502: 	s= s + "The forecast is heavy intensity rain";break;
            case 503: 	s= s + "The forecast is very heavy rain";break;
            case 504: 	s= s + "The forecast is extreme rain";break; 	
            case 511: 	s= s + "The forecast is freezing rain";break; 	
            case 520: 	s= s + "The forecast is light intensity shower rain";break;
            case 521: 	s= s + "The forecast is shower rain";break;
            case 522: 	s= s + "The forecast is heavy intensity shower rain";break;
            case 531:   s= s + "The forecast is ragged shower rain";break;
                
            case 600: 	s= s + "The forecast is light snow";break;
            case 601: 	s= s + "The forecast is snow";break;
            case 602: 	s= s + "The forecast is heavy snow";break;
            case 611: 	s= s + "The forecast is sleet";break;
            case 612: 	s= s + "The forecast is shower sleet";break;
            case 615: 	s= s + "The forecast is light rain and snow";break;
            case 616: 	s= s + "The forecast is rain and snow";break;
            case 620: 	s= s + "The forecast is light shower snow";break;
            case 621: 	s= s + "The forecast is shower snow";break;
            case 622: 	s= s + "The forecast is heavy shower snow";break; 
                
            case 701: 	s= s + "The forecast is misy";break;
            case 711: 	s= s + "The forecast is smoke";break;
            case 721: 	s= s + "The forecast is haze";break;
            case 731: 	s= s + "The forecast is sand or dust whirls";break;
            case 741: 	s= s + "The forecast is fog";break;
            case 751: 	s= s + "The forecast is sand";break;
            case 761: 	s= s + "The forecast is dust";break;
            case 762: 	s= s + "The forecast is volcanic ash";break;
            case 771: 	s= s + "The forecast is squalls";break;
            case 781: 	s= s + "The forecast is tornado";break; 
                
            case 800:    s= s + "The forecast is clear sky";break;
            case 801: 	s= s + "The forecast is few clouds";break;
            case 802: 	s= s + "The forecast is scattered clouds";break;
            case 803: 	s= s + "The forecast is broken clouds";break;
            case 804: 	s= s + "The forecast is overcast clouds";break; 
                
            case 900: 	s= s + "The forecast is tornado";break;
            case 901: 	s= s + "The forecast is tropical storm";break;
            case 902: 	s= s + "The forecast is hurricane";break;
            case 903: 	s= s + "The forecast is extreme cold";break;
            case 904: 	s= s + "The forecast is extreme hot";break;
            case 905: 	s= s + "The forecast is extremely windy";break;
            case 906: 	s= s + "The forecast is extremely hail";break;
                
                
        }
        switch (i){
            case 951: 	s= s + ". The wind is calm";break;
            case 952: 	s= s + ". The wind is light breeze";break;
            case 953: 	s= s + ". The wind is gentle breeze"; break;
            case 954: 	s= s + ". The wind is moderate breeze";break;
            case 955: 	s= s + ". The wind is fresh breeze";break;
            case 956: 	s= s + ". The wind is strong breeze";break;
            case 957: 	s= s + ". The wind is high wind, near gale";break;
            case 958: 	s= s + ". The wind is gale";break;
            case 959: 	s= s + ". The wind is severe gale";break;
            case 960: 	s= s + ". The wind is storm";break;
            case 961: 	s= s + ". The wind is violent storm";break;
            case 962: 	s= s + ". The wind is hurricane";break;
        }
        return (s);
    }

    public static String getImage(int i, GregorianCalendar startHour) {
        String s ="/images/";
        boolean b = (startHour.get(Calendar.HOUR_OF_DAY) >= 6 && startHour.get(Calendar.HOUR_OF_DAY) <= 18);
        
        if((i >= 900 && i <= 906) ||(i >= 700 && i <= 799)){
            s =  s + "Danger";
        }else{
        switch(i){
            case 200: 	s= s + "Thunderstorm";break;
            case 201: 	s= s + "Thunderstorm";break;
            case 202: 	s= s + "Thunderstorm";break;
            case 210: 	s= s + "Thunderstorm";break;
            case 211: 	s= s + "Thunderstorm";break;
            case 212: 	s= s + "Thunderstorm";break;
            case 221: 	s= s + "Thunderstorm";break;
            case 230: 	s= s + "Thunderstorm";break;
            case 231: 	s= s + "Thunderstorm";break;
            case 232: 	s= s + "Thunderstorm"; break;
                
            case 300:	s= s + "Rain&Cloud";break;
            case 301: 	s= s + "Rain&Cloud";break;
            case 302: 	s= s + "Rain&Cloud";break;
            case 310: 	s= s + "Rain&Cloud";break;
            case 311: 	s= s + "Rain&Cloud";break;
            case 312: 	s= s + "Rain&Cloud";break;
            case 313: 	s= s + "Rain&Cloud";break;
            case 314: 	s= s + "Rain&Cloud";break;
            case 321: 	s= s + "Rain&Cloud";break;
                
            case 500: 	if(b){
                            s= s + "LightRain";
                        }else{
                            s= s + "Moon&Rain";
                        }
                        break;
            case 501: 	if(b){
                            s= s + "LightRain";
                        }else{
                            s= s + "Moon&Rain";
                        }
                        break;
            case 502: 	if(b){
                            s= s + "LightRain";
                        }else{
                            s= s + "Moon&Rain";
                        }
                        break;
            case 503: 	if(b){
                            s= s + "LightRain";
                        }else{
                            s= s + "Moon&Rain";
                        }
                        break;
            case 504: 	if(b){
                            s= s + "LightRain";
                        }else{
                            s= s + "Moon&Rain";
                        }
                        break;	
            case 511: 	s= s + "Snow";break; 	
            case 520: 	s= s + "Rain&Cloud";break;
            case 521: 	s= s + "Rain&Cloud";break;
            case 522: 	s= s + "Rain&Cloud";break;
            case 531:   s= s + "Rain&Cloud";break;
                
            case 600: 	s= s + "Snow";break;
            case 601: 	s= s + "Snow";break;
            case 602: 	s= s + "Snow";break;
            case 611: 	s= s + "Snow";break;
            case 612: 	s= s + "Snow";break;
            case 615: 	s= s + "Snow";break;
            case 616: 	s= s + "Snow";break;
            case 620: 	s= s + "Snow";break;
            case 621: 	s= s + "Snow";break;
            case 622: 	s= s + "Snow";break; 
                
            case 800:   if(b){
                            s= s + "Sun";
                        }else{
                            s= s + "Moon";
                        }
                        break;
            case 801: 	if(b){
                            s= s + "Cluod&Sun";
                        }else{
                            s= s + "Moon&Cluod";
                        }
                        break;
            case 802: 	s= s + "Cloud";break;
            case 803: 	s= s + "ReallyCloud";break;
            case 804: 	s= s + "ReallyCloud";break;

            case 951: 	s= s + "Wind";break;
            case 952: 	s= s + "Wind";break;
            case 953: 	s= s + "Wind"; break;
            case 954: 	s= s + "Wind";break;
            case 955: 	s= s + "Wind";break;
            case 956: 	s= s + "Wind";break;
            case 957: 	s= s + "Wind";break;
            case 958: 	s= s + "Wind";break;
            case 959: 	s= s + "Wind";break;
            case 960: 	s= s + "Wind";break;
            case 961: 	s= s + "Wind";break;
            case 962: 	s= s + "Wind";break;
            default:  s = s + "";
        }}
        s = s + "_icon.png";
        return(s);
    }
}
